"""
    Controller for education history.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class EducationHistoryController(LookupController, CRUDController):
    model_object = model.EducationHistory
    lookup_columns = [
        TableCol(name='student', caption=_('Student')),
        TableCol(name='group_title', caption=_('Group')),
        TableCol(name='group_open_date', caption=_('Group open date')),
        TableCol(name='group_close_date', caption=_('Group close date')),
        TableCol(name='plan_abbr', caption=_('Plan abbr')),
    ]

    view_fields = [
        'studentID',
        'groupTitle',
        'groupOpenDate',
        'groupCloseDate',
        'planAbbr',
        ]

    edit_fields = []

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('education_history_lookup'),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = EducationHistoryController()
